//
//  Tool.m
//  MGameTribe
//
//  Created by 杨敏 on 13-5-30.
//  Copyright (c) 2013年 YangMin. All rights reserved.
//

#import "Tool.h"
#import "UIDevice+Hardware.h"
#import "MBProgressHUD.h"


#define DEFAULT_VOID_COLOR [UIColor blackColor]

@interface Tool()
{
    
}

@end
@implementation Tool
@synthesize systemVersion,isFourInch,isSimulator;

#pragma mark - sharedTool
static Tool *sharedTool;
+ (Tool *)sharedTool {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedTool=[[Tool alloc]init];
    });
	return sharedTool;
}
+ (id)allocWithZone:(NSZone *)zone {
    __block id singleTon=nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedTool=[super allocWithZone:zone];
        singleTon=sharedTool;
    });
    return singleTon;
}
- (id)copyWithZone:(NSZone *)zone {
    return self;
}


- (id)init {
    if (self = [super init]){
        systemVersion=[[[UIDevice currentDevice]systemVersion]floatValue];
        isFourInch=CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size);
        isSimulator=[[[UIDevice currentDevice]hardwareDescription]isEqualToString:SimulatorHardWareName];

    }
    return self;
}
- (void)dealloc { // Should never be called, but just here for clarity really.

}

#pragma mark - UI Tool
+(void)stopScaling:(UIImageView *)view{
    
    [view.layer removeAllAnimations];
    [view stopAnimating];
}

+(void)startScaling:(UIImageView *)view{
    if ([view.layer animationForKey:@"transform"]) {
        return;
    }
    
    CAKeyframeAnimation *theAnimation = [CAKeyframeAnimation animation];
	theAnimation.values = [NSArray arrayWithObjects:
                           [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0,1)],
						   [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5, 0.5,1)],
						   [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.2, 1.2,1)],
						   [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5, 0.5,1)],
                           [NSValue valueWithCATransform3D:CATransform3DMakeScale(1.0, 1.0,1)],
						   nil];
	theAnimation.cumulative = YES;
	theAnimation.duration = 1.0;
	theAnimation.repeatCount = HUGE_VALF;
	theAnimation.removedOnCompletion = YES;
    theAnimation.timingFunctions = @[[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
    [view.layer addAnimation:theAnimation forKey:@"transform"];
}

MBProgressHUD* GetTargetHudWithTag(UIView *contannerView,int tag){
    __block MBProgressHUD *targetHUd=nil;
    NSArray *huds=[MBProgressHUD allHUDsForView:contannerView];
    [huds enumerateObjectsUsingBlock:^(MBProgressHUD *obj, NSUInteger idx, BOOL *stop) {
        if (obj.tag==tag) {
            targetHUd=obj;
        }
    }];
    return targetHUd;
}
void SafeShowHudForContainer(UIView *containnerV ,int tag){
    if (!containnerV) {
        return;
    }
    MBProgressHUD *hud =GetTargetHudWithTag(containnerV, tag);
    if (!hud) {
        hud=[MBProgressHUD showHUDAddedTo:containnerV animated:YES];
        hud.tag=tag;
    }
}

void SafeShowHudWithMsgForContainer(UIView *containnerV ,int tag,NSString *msg){
    if (!containnerV) {
        return;
    }
    MBProgressHUD *hud =GetTargetHudWithTag(containnerV, tag);
    if (!hud) {
        hud = [MBProgressHUD showHUDAddedTo:containnerV animated:YES];
        hud.detailsLabelText=msg;
        hud.tag=tag;
    }else{
        hud.mode=MBProgressHUDModeIndeterminate;
        hud.detailsLabelText=msg;
    }
}

void HideHud(UIView *view,int tag,NSString *msg,CGFloat delay){
    if (msg) {
        MBProgressHUD *targetHud=GetTargetHudWithTag(view, tag);
        [targetHud hide:YES];
        //[targetHud hideWithImage:nil text:msg animated:YES delay:delay];
    }
    else{
        [MBProgressHUD hideAllHUDsForView:view animated:YES];
    }
}



void CGRectSetX(UIView *view, CGFloat x) {
    CGRect frame =view.frame;
    frame.origin.x=x;
    view.frame=frame;
}

void CGRectSetY(UIView *view, CGFloat y) {
    CGRect frame =view.frame;
    frame.origin.y=y;
    view.frame=frame;
}

void CGRectSetCenterX(UIView *view, CGFloat centerX) {
    CGPoint center=view.center;
    center.x=centerX;
    view.center=center;
}

void CGRectSetCenterY(UIView *view, CGFloat centerY) {
    CGPoint center=view.center;
    center.y=centerY;
    view.center=center;
}

void CGRectSetWidth(UIView *view, CGFloat width) {
    CGRect frame =view.frame;
    frame.size.width=width;
    view.frame=frame;
}

void CGRectSetHeight(UIView *view, CGFloat height) {
    CGRect frame =view.frame;
    frame.size.height=height;
    view.frame=frame;
}


void CGRectSetOrigin(UIView *view, CGPoint origin) {
    CGRect frame =view.frame;
    frame.origin=origin;
    view.frame=frame;
}


void CGRectSetSize(UIView *view, CGSize size) {
    CGRect frame =view.frame;
    frame.size=size;
    view.frame=frame;
}


void CGRectSetZeroOrigin(UIView *view) {
    CGRect frame =view.frame;
    frame.origin=CGPointMake(0,0);
    view.frame=frame;
}

void CGRectSetZeroSize(UIView *view) {
    CGRect frame =view.frame;
    frame.size=CGSizeMake(0,0);
    view.frame=frame;
}
//根据文字内容，字体大小，size获得lab的size
CGSize GetLabelSizeWithText(NSString *text,UIFont *font,CGSize maxSize){
    CGSize targetSize=CGSizeZero;

    if (SystemVersion<7.0) {
        targetSize = [text sizeWithFont:font constrainedToSize:maxSize lineBreakMode:NSLineBreakByWordWrapping];
    }
    else{
        
        NSDictionary *attributesDictionary =@{NSFontAttributeName:font};
        
        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString: getSafeStringWithObject(text) attributes:attributesDictionary];
        /*
        NSMutableParagraphStyle *paragrahStyle = [[NSMutableParagraphStyle alloc] init];
        [paragrahStyle setLineSpacing:0];
        [attributedString addAttribute:NSParagraphStyleAttributeName value:paragrahStyle range:NSMakeRange(0, [text length])];
        */
        targetSize = [attributedString boundingRectWithSize:maxSize options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading) context:nil].size;
        
        //NSLog(@"text:%@,attributes:%@,targetSize:%@",text,attributesDictionary,NSStringFromCGSize(targetSize));
     
    }
    if (!checkString(text)) {
        targetSize.height=0;
    }
    targetSize.width=MAX(0, targetSize.width);
    targetSize.height=MAX(0, targetSize.height);
    return targetSize;
}
CGSize GetLableSizeWithLabel(UILabel *label,CGSize maxSize){
    CGRect newFrame=label.frame;
    CGSize tempSize=[label sizeThatFits:maxSize];
    newFrame.size.width=MIN(maxSize.width, tempSize.width);
    newFrame.size.height=MIN(maxSize.height, tempSize.height);
    return tempSize;
}

void FitLableWithSize(CGSize maxSize,UILabel *label){
    CGRect newFrame=label.frame;
    newFrame.size=GetLableSizeWithLabel(label,maxSize);
    label.frame=newFrame;
}
void FitLableWidthWithLabel(UILabel *label){
    CGFloat labelWidth = GetLabelSizeWithText(label.text, label.font, CGSizeMake(MAXFLOAT, CGRectGetHeight(label.frame))).width;
    CGRect labelFrame = label.frame;
    labelFrame.size.width=MAX(0, labelWidth);
    label.frame=labelFrame;
}

void FitLableHeightWithLabel(UILabel *label){
    NSString *testBlankStr=label.text;
    if (!checkString(testBlankStr)) {
        testBlankStr = @" ";
    }
    CGFloat labelHeight = GetLabelSizeWithText(testBlankStr, label.font, CGSizeMake(label.frame.size.width, MAXFLOAT)).height;
    CGRect labelFrame = label.frame;
    labelFrame.size.height=MAX(0, labelHeight);
    label.frame=labelFrame;
}

void SetCorner(CGFloat corner,UIView *view){
    view.layer.cornerRadius=corner;
    view.layer.masksToBounds=YES;
}
//
void FillButton(UIButton *button){
    button.imageView.clipsToBounds=YES;
    button.contentVerticalAlignment=UIControlContentVerticalAlignmentFill;
    button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentFill;
    button.imageView.contentMode=UIViewContentModeScaleAspectFill;//貌似没用
}
void CenterTheButton(UIButton *button){
    button.clipsToBounds=YES;
    button.contentVerticalAlignment=UIControlContentVerticalAlignmentCenter;
    button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentCenter;
    button.imageView.contentMode=UIViewContentModeCenter;
}
void CircleClipView(UIView *view){
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:view.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(view.frame.size.width/2, view.frame.size.width/2)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.path = maskPath.CGPath;
    maskLayer.frame = view.bounds;
    view.layer.mask = maskLayer;
    view.layer.masksToBounds=YES;
}

+(UIImage *)resizeImageWithImage:(UIImage *)sourceImg left:(float)left right:(float)right top:(float)top bottom:(float)bottom{
    UIImage *image=nil;
    if (SystemVersion >= 5.0) {
        image =[sourceImg resizableImageWithCapInsets:UIEdgeInsetsMake(top,left,bottom,right)];
    }
    else{
        if (left==0&&right!=0) {
            left=sourceImg.size.width-right-1;
            left=MAX(1, left);
        }
        /*
        if (right==0 && left!=0) {
            right=sourceImg.size.width-left-1;
            right=MAX(1, right);
        }*/
        
        if (top==0&&bottom!=0) {
            top=sourceImg.size.height-bottom-1;
            top=MAX(1, top);
        }
        /*
        if (bottom==0&&top!=0) {
            bottom=sourceImg.size.height-top-1;
            bottom=MAX(1, bottom);
        }
        */
        image = [sourceImg stretchableImageWithLeftCapWidth:left topCapHeight:top];
    }
    return image;
}
+ (UIImage *)CaptureView:(UIView *)view
{
    
    UIGraphicsBeginImageContextWithOptions(view.frame.size, YES, [UIScreen mainScreen].scale);
    CGContextRef contenxt =  UIGraphicsGetCurrentContext();
    
    [view.layer renderInContext:contenxt];
    
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return newImage;
}
void SafePresentViewController(UIViewController *presenter,UIViewController *targetController,FunctonBlock completionBlock,BOOL animated){
    if (SystemVersion<=5.0) {
        [presenter presentViewController:targetController animated:animated completion:nil];
        if (completionBlock) {
            completionBlock();
        }
    }
    else{
        [presenter presentViewController:targetController animated:animated completion:completionBlock];
    }
}
void SafeDismissViewController(UIViewController *controller,FunctonBlock completionBlock,BOOL animated){
    //ApplicationDelegate.presenttingVC=nil;
    if (SystemVersion<=5.0) {
        [controller dismissViewControllerAnimated:animated completion:nil];
        if (completionBlock) {
            completionBlock();
        }
    }
    else{
        [controller dismissViewControllerAnimated:animated completion:completionBlock];
    }
}
void ReleaseViewWithController(UIViewController *controller){
    if (SystemVersion >= 6.0 && [controller isViewLoaded] && controller.view.window == nil) {
        controller.view=nil;
        //[controller viewDidUnload];
    }
}

+(UIImage *)getImageWithName:(NSString *)imgName imgFormat:(NSString *)imgFormat cache:(BOOL)cache{
    //NSLog(@"imgName:%@ imgFormat:%@ cache:%d",imgName,imgFormat,cache);
    UIImage *image=nil;
    if (!checkString(imgName)) {
        return nil;
    }
    NSString *format=imgFormat;
    NSString *key=imgName;
    
    NSString *imgPath=nil;

    if ([imgName hasSuffix:@".png"]||[imgName hasSuffix:@".jpg"]) {
        format=[imgName substringWithRange:NSMakeRange(imgName.length-3,3)];
    }
    else{
        key=[NSString stringWithFormat:@"%@.%@",imgName,format];
    }
     //NSLog(@"key:%@ format:%@",key,format);
    /*
     if (cache) {
     image=[[SDImageCache sharedImageCache]imageFromKey:key];
     if (image) {
     return image;
     }
     }
     */
    
    // NSLog(@"[UIScreen mainScreen].scale : %f",[UIScreen mainScreen].scale);
    if (([UIScreen mainScreen].scale >= 1.9f)) {
        if ([imgName hasSuffix:@".png"]||[imgName hasSuffix:@".jpg"]) {
            NSString *imname_twoPixel=[NSString stringWithFormat:@"%@@2x",[ imgName substringWithRange:NSMakeRange(0, imgName.length-4)]];
            imgPath=[[NSBundle mainBundle]pathForResource:imname_twoPixel ofType:format] ;
        }
        else{
            imgPath=[[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"%@@2x", imgName] ofType:format] ;
        }
        
        if (!imgPath) {
            imgPath=[[NSBundle mainBundle]pathForAuxiliaryExecutable:key] ;
        }
         //NSLog(@"640*960 -- imgPath:%@",imgPath);
    }
    else{
        imgPath=[[NSBundle mainBundle]pathForAuxiliaryExecutable:key] ;
        
        if (!imgPath) {
            if ([imgName hasSuffix:@".png"]||[imgName hasSuffix:@".jpg"]) {
                NSString *imname_twoPixel=[NSString stringWithFormat:@"%@@2x",[ imgName substringWithRange:NSMakeRange(0, imgName.length-4)]];
                imgPath=[[NSBundle mainBundle]pathForResource:imname_twoPixel ofType:format] ;
            }
            else{
                imgPath=[[NSBundle mainBundle]pathForResource:[NSString stringWithFormat:@"%@@2x", imgName] ofType:format] ;
            }
        }
        //NSLog(@"320*480 -- imgPath:%@",imgPath);
    }
    //NSLog(@"imgPath:%@,class:%@",imgPath,imgPath.class);
    if ([imgPath isKindOfClass:[NSString class]]) {
        if (cache) {
            imgPath=[NSString stringWithFormat:@"%@.%@",imgName,imgFormat];
            image=[UIImage imageNamed:imgPath];
        }
        else{
            //image=[[[UIImage alloc ]initWithContentsOfFile:imgPath]autorelease];
            image=[[UIImage alloc]initWithContentsOfFile:imgPath];
        }
        // NSURL *url =[NSURL URLWithString:imgPath];
        
        /* if (cache) {
         image = [[[AsyncImageLoader sharedLoader]cache]objectForKey:url];
         }*/
        /*if (!image) {
            image=[UIImage imageWithContentsOfFile:imgPath];
             if (cache) {
             //  [[SDImageCache sharedImageCache]storeImage:image forKey:imgPath toDisk:YES];
             if (url && image) {
             [[AsyncImageLoader sharedLoader].cache setValue:image forKey:url];
             }
             }*/
        //}
        
    }
    
    return  image;
}
+(void) alertViewWithMessage:(NSString *) message {
    NSString *title = nil;
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil];
    [alert show];
}

UIColor *ColorWithHexString(NSString *stringToConvert){
    NSString *cString = [[stringToConvert stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    
    if ([cString length] < 6)
        return DEFAULT_VOID_COLOR;
    if ([cString hasPrefix:@"#"])
        cString = [cString substringFromIndex:1];
    if ([cString length] != 6)
        return DEFAULT_VOID_COLOR;
    
    NSRange range;
    range.location = 0;
    range.length = 2;
    NSString *rString = [cString substringWithRange:range];
    
    range.location = 2;
    NSString *gString = [cString substringWithRange:range];
    
    range.location = 4;
    NSString *bString = [cString substringWithRange:range];
    
    
    unsigned int r, g, b;
    [[NSScanner scannerWithString:rString] scanHexInt:&r];
    [[NSScanner scannerWithString:gString] scanHexInt:&g];
    [[NSScanner scannerWithString:bString] scanHexInt:&b];
    
    return [UIColor colorWithRed:((float) r / 255.0f)
                           green:((float) g / 255.0f)
                            blue:((float) b / 255.0f)
                           alpha:1.0f];
}

#pragma mark - DelegateHelper
void LetDelegatePerformSelector(id delegate,SEL selector,id object){
    if (delegate && [delegate respondsToSelector:selector]) {
        [delegate performSelector:selector withObject:object];
    }
}

#pragma mark - 表情字符相关的编解码
+ (NSString *)emojiStrEncoding:(NSString *)Str {
    NSArray *ios6EmojiArr = [ApplicationDelegate emojiStrings];
    NSArray *ios5EmojiArr = [self ios5EmojiArray];
    NSArray *ios4EmojiArr = [self ios4EmojiArray];
    
    NSMutableString *inputStr = [[NSMutableString alloc] initWithString:Str];
    
    [inputStr enumerateSubstringsInRange:NSMakeRange(0, [inputStr length]) options:NSStringEnumerationByComposedCharacterSequences
                              usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
                                  //NSLog(@"substring: %@",substring);
                                  
                                  int length = [substring lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
                                  
                                  if (length >= 3) {
                                      //NSLog(@"substring length: %d",length);
                                      if (SystemVersion>=6.0) {
                                          for (id oneObject in ios6EmojiArr) {
                                              if ([substring isEqualToString:oneObject]) {
                                                  int index = [ios6EmojiArr indexOfObject:oneObject];
                                                  NSLog(@"oneObject:%@ ,index in ios5EmojiArr:%d",oneObject,index);
                                                  
                                                  NSString *repStr = [NSString stringWithFormat:@"<ef%04def>",index];
                                                  [inputStr replaceCharactersInRange:substringRange withString:repStr];
                                                  
                                                  break;
                                                  
                                              }
                                          }

                                      }
                                      else if (SystemVersion>=5.0) {
                                          for (id oneObject in ios5EmojiArr) {
                                              if ([substring isEqualToString:oneObject]) {
                                                  int index = [ios5EmojiArr indexOfObject:oneObject];
                                                  NSLog(@"oneObject:%@ ,index in ios5EmojiArr:%d",oneObject,index);

                                                  NSString *repStr = [NSString stringWithFormat:@"<ef%04def>",index];
                                                  [inputStr replaceCharactersInRange:substringRange withString:repStr];
                                                  
                                                  break;
                                                  
                                              }
                                          }
                                      }
                                      else {
                                          for (id oneObject in ios4EmojiArr) {
                                              if ([substring isEqualToString:oneObject]) {
                                                  int index = [ios4EmojiArr indexOfObject:oneObject];
                                                  NSLog(@"oneObject:%@ ,index in ios4EmojiArr:%d",oneObject,index);
                                                  NSString *repStr = [NSString stringWithFormat:@"<ef%04def>",index];
                                                  [inputStr replaceCharactersInRange:substringRange withString:repStr];
                                                  
                                                  break;
                                                  
                                              }
                                          }
                                      }
                                  }
                              }];
    
    return inputStr;
}

+ (NSString *)emojiStrUnicodeEncoding:(NSString *)Str {
    NSArray *ios4EmojiArr = [self ios4EmojiArray];
    NSMutableString *inputStr = [[NSMutableString alloc] initWithString:Str];
    [inputStr enumerateSubstringsInRange:NSMakeRange(0, [inputStr length]) options:NSStringEnumerationByComposedCharacterSequences
                              usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
                                  //NSLog(@"substring: %@",substring);
                                  int length = [substring lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
                                  if (length >= 3) {
                                      //NSLog(@"substring length: %d",length);
                                      for (id oneObject in ios4EmojiArr) {
                                          if ([substring isEqualToString:oneObject]) {
                                              int index = [ios4EmojiArr indexOfObject:oneObject];
                                              NSLog(@"oneObject:%@ ,index in ios4EmojiArr:%d",oneObject,index);
                                              NSString *repStr = [NSString stringWithFormat:@"<ef%04def>",index];
                                              [inputStr replaceCharactersInRange:substringRange withString:repStr];
                                              break;
                                          }
                                      }
                                  }
                              }];
    
    return inputStr;
}
+ (NSString *)replaceEmojiStr:(NSString *)receiveStr {
    NSArray *ios6EmojiArr = [ApplicationDelegate emojiStrings];
    NSArray *ios5EmojiArr =  [self ios5EmojiArray];
    NSArray *ios4EmojiArr = [self ios4EmojiArray];

    NSArray *arr = [receiveStr componentsSeparatedByString:@"<ef"];
    
    if ([arr count] == 1) {
        return receiveStr;
    }
    
    for (int i = 0; i < [arr count]; i++) {
        NSRange startRange = [receiveStr rangeOfString:@"<ef"];
        NSRange endRange = [receiveStr rangeOfString:@"ef>"];
        
        if (startRange.length > 0 && endRange.length > 0 && (endRange.location - startRange.location == 7)) {
            //NSLog(@"receiveStr:%@",receiveStr);
            
            NSString *emojiIndex = [receiveStr substringWithRange:NSMakeRange(startRange.location + 3, 4)];
            
            //NSLog(@"emojiIndex:%@",emojiIndex);
            if (![Tool isPureInt:emojiIndex]) {
                return receiveStr;
            }
            
            NSString *newStr = [[NSString alloc] initWithString:receiveStr];
            //NSLog(@"newStr:%@",newStr);
            
            int index = [emojiIndex intValue];
            if (SystemVersion>=6.0) {
                if ([ios6EmojiArr count] > index) {
                    receiveStr = [newStr stringByReplacingCharactersInRange:NSMakeRange(startRange.location, 10) withString:[ios6EmojiArr objectAtIndex:index]];
                }
            }
            else if (SystemVersion>=5.0) {
                if ([ios5EmojiArr count] > index) {
                    receiveStr = [newStr stringByReplacingCharactersInRange:NSMakeRange(startRange.location, 10) withString:[ios5EmojiArr objectAtIndex:index]];
                }
            }
            else {
                if ([ios4EmojiArr count] > index) {
                    receiveStr = [newStr stringByReplacingCharactersInRange:NSMakeRange(startRange.location, 10) withString:[ios4EmojiArr objectAtIndex:index]];
                }
            }
            //NSLog(@"finnal receiveStr:%@",receiveStr);
        }
    }
    
    return receiveStr;
}
+ (NSString *) subStringWithUTF8EmojiString:(NSString *) utf8EmojiString {
    NSMutableString *tempString = [NSMutableString string];
    NSMutableArray *mutableArray = [NSMutableArray array];
    [utf8EmojiString enumerateSubstringsInRange:NSMakeRange(0, [utf8EmojiString length])
                                        options:NSStringEnumerationByComposedCharacterSequences
                                     usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
                                         //NSLog(@"enclosingRange = %d %d",substringRange.length,substringRange.location);
                                         [mutableArray addObject:substring];
                                     }];
    [mutableArray removeLastObject];
    for (NSString *string in mutableArray) {
        [tempString appendString:string];
    }
    
    
    return [NSString stringWithString:tempString];
}

NSString * EmojiStringWithoutBreakLine(NSString *string){
    
    string=[Tool replaceEmojiStr:string];
    string=[Tool stringByRemoveLineBreakChar:string];

    
    return string;
}
NSString *StringWithEmojiEncoding(NSString *string){
    string =[Tool emojiStrEncoding:[Tool emojiStrUnicodeEncoding:string]];
    return string;
}
+ (BOOL)isPureInt:(NSString *)string {
    NSScanner *scan = [NSScanner scannerWithString:string];
    int val;
    
    return [scan scanInt:&val] && [scan isAtEnd];
}
+(NSString *)stringByRemoveLineBreakChar:(NSString *)sourceString{
    NSCharacterSet *whitespace = [NSCharacterSet whitespaceAndNewlineCharacterSet];
    NSString *contentTextStr = [sourceString stringByTrimmingCharactersInSet:whitespace];
    return contentTextStr;
}

+(void)clearNotificationCenter{
   // [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
    [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
    /*UIApplication* application = [UIApplication sharedApplication];
    NSArray* scheduledNotifications = [NSArray arrayWithArray:application.scheduledLocalNotifications];
    application.scheduledLocalNotifications = scheduledNotifications;
    
    [[UIApplication sharedApplication]cancelAllLocalNotifications];*/
}
//#pragma mark - get/write custom plist file
//+(NSMutableDictionary *)getBasicInfoPlistInPlist:(NSString *)plistName{
//    NSString *path = [[PathManager sharedPathManager] attachmentDocumentPathByName:plistName];
//    NSMutableDictionary *basicInfo = [NSMutableDictionary dictionaryWithContentsOfFile:path];
//    
//    if (!basicInfo) {
//        basicInfo=[NSMutableDictionary dictionary];
//        NSString *path = [[PathManager sharedPathManager]attachmentDocumentPathByName:plistName];
//        [[PathManager sharedPathManager] buildPathForFile:path];
//        [basicInfo writeToFile :path atomically : YES] ;
//        // NSLog(@"createBasicInfo:----->%d",createBasicInfo);
//    }
//    
//    return basicInfo ;
//}
//+(void)writeObject:(id)object plistName:(NSString *)plistName{
//    NSString *path = [[PathManager sharedPathManager]attachmentDocumentPathByName:plistName];
//    [[PathManager sharedPathManager] buildPathForFile:path];
//    // NSLog(@"path:%@",path);
//    //NSLog(@"object's key:%@ object's value:%@",[basicInfo allKeys],[basicInfo allValues]);
//    if (checkValue(object)) {
//        BOOL writeSuccess = [object writeToFile :path atomically : YES] ;
//        if (!writeSuccess) {
//            //NSLog(@"write object :%@ ,Success:------%d",object,writeSuccess);
//        }
//    }
//    else{
//        NSFileManager *manager=[NSFileManager defaultManager];
//        BOOL deleteSuccess =[manager removeItemAtPath:path error:NULL];
//        if (!deleteSuccess) {
//            // NSLog(@"delete path :%@ ,Success:------%d",path,deleteSuccess);
//        }
//    }
//}
//+(void)setLocolInfo:(id)object forKey:(NSString *)key inPlist:(NSString *)plistName{
//    
//    // NSLog(@"object:%@ class:%@",object,[object class]);
//    NSMutableDictionary *basicInfo = [Tool getBasicInfoPlistInPlist:plistName];
//    //NSLog(@"object's key:%@ object's value:%@",[basicInfo allKeys],[basicInfo allValues]);
//    //  NSLog(@"basicInfo:%@ class:%@",basicInfo,[basicInfo class]);
//    
//    if (object) {
//        [basicInfo setValue:object forKey:key];
//    }
//    else {
//        [basicInfo removeObjectForKey:key];
//    }
//    
//    NSString *path = [[PathManager sharedPathManager]attachmentDocumentPathByName:plistName];
//    [[PathManager sharedPathManager] buildPathForFile:path];
//    // NSLog(@"path:%@",path);
//    //NSLog(@"object's key:%@ object's value:%@",[basicInfo allKeys],[basicInfo allValues]);
//    [basicInfo writeToFile :path atomically : YES] ;
//    //NSLog(@"writePath:%@ Success:------%d",path,writeSuccess);
//}

+(id)getLocolInfoWithKey:(NSString *)key inPlist:(NSString *)plistName{
    NSMutableDictionary *basicInfo = [Tool getBasicInfoPlistInPlist:plistName];
    id object=[basicInfo objectForKey:key];
    
    return object;
}
#pragma mark - get/write NSUserDefault

+(id)getDefaultsObjectWithKey:(NSString *)key{
    return [[NSUserDefaults standardUserDefaults]objectForKey:key];
}
+(void)setDefaultsObject:(id)object forKey:(NSString *)key{
    
    [[NSUserDefaults standardUserDefaults]setValue:checkValue(object)?object:nil forKey:key];
    [[NSUserDefaults standardUserDefaults]synchronize];
}
//#pragma mark - LoadDataFromDatabase
//+(NSMutableDictionary *)getDataFromDBWithTargetId:(id)targetId targetKey:(id)targetKey table:(NSString *)table{
//    __block NSMutableDictionary *dictionary =nil;
//    [ApplicationDelegate.dataBaseQueue inDatabase:^(FMDatabase *db) {
//        NSString *SQL=[NSString stringWithFormat:@"select * from %@ where %@ = %@",table,targetKey,targetId];
//        //NSLog(@"SQL:%@",SQL);
//        FMResultSet *result=[db executeQuery:SQL];
//        if ([result next]) {
//            dictionary=[NSMutableDictionary dictionaryWithDictionary:result.resultDictionary];
//        }
//        [result close];
//    }];
//    //   NSLog(@"dictionary: %@",dictionary);
//    
//    return dictionary;
//}

//+(int)getTotalCountFromTable:(NSString *)tableName{
//    __block int count =0;
//    [ApplicationDelegate.dataBaseQueue inDatabase:^(FMDatabase *db) {
//        NSString *SQL=[NSString stringWithFormat:@"select count(*) from %@",tableName];
//        FMResultSet *result =[db executeQuery:SQL];
//        if ([result next]) {
//            count = [result intForColumnIndex:0];
//        }
//        [result close];
//    }];
//    return count;
//}
//#pragma mark - SaveSQL
////获得根据sql的keys获得sql的信息1
//+(NSMutableDictionary *)getSQLSatatementsWithSQLKeys:(NSArray *)sqlKeys tableName:(NSString *)tableName{
//    if (!checkList(sqlKeys)) {
//        return nil;
//    }
//    //pack sql statements:
//    //更新
//    NSMutableString * SQL_updatePrefix=[NSMutableString  stringWithFormat:@"update %@ set ",tableName];
//    //插入
//    NSMutableString * SQL_insertPrefix=[NSMutableString stringWithFormat:@"insert into %@ ( ",tableName];
//    
//    NSMutableString * SQL_insertsurfix=[NSMutableString stringWithFormat:@"values ( "];
//    
//    [sqlKeys enumerateObjectsUsingBlock:^(NSString *key, NSUInteger idx, BOOL *stop) {
//        
//        [SQL_updatePrefix appendFormat:@"%@ = ? ",key];
//        [SQL_insertPrefix appendFormat:@"%@ ",key];
//        
//        if (idx!=sqlKeys.count-1) {
//            [SQL_updatePrefix appendString:@", "];
//            [SQL_insertPrefix appendString:@", "];
//            [SQL_insertsurfix appendString:@"?, "];
//        }
//        else{
//            [SQL_insertPrefix appendString:@") "];
//            [SQL_insertsurfix appendString:@"?) "];
//        }
//        
//    }];
//    NSString *insertString_full =[NSString stringWithFormat:@"%@%@",SQL_insertPrefix,SQL_insertsurfix];
//    NSMutableDictionary *dictionary=[NSMutableDictionary dictionary];
//    [dictionary setValue:insertString_full forKey:SQLKey_FullInsert];
//    [dictionary setValue:SQL_updatePrefix forKey:SQLKey_UpdatePrefix];
//    return dictionary;
//}
//2
//+(void)saveSQLwithSQLKeys:(NSArray *)sqlKeys objects:(NSArray *)objects tableName:(NSString *)tableName targetKeys:(NSArray *)targetKeys targetObjects:(NSArray *)targetObjects{
//    //NSLog(@"sqlKeys:%@,objects:%@,tableName:%@,targetKeys:%@,targetObjects:%@",sqlKeys,objects,tableName,targetKeys,targetObjects);
//    if (!checkList(objects) ){
//        return;
//    }
//    NSDictionary *SQL_statements=[Tool getSQLSatatementsWithSQLKeys:sqlKeys tableName:tableName];
//    
//    NSString *updatePrefix=SQL_statements[SQLKey_UpdatePrefix];
//    NSString *insertString=SQL_statements[SQLKey_FullInsert];
//    if (!checkString(updatePrefix) || !checkString(insertString)) {
//        return;
//    }
//    [ApplicationDelegate.dataBaseQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
//        NSMutableString *whereSufix =nil;
//        if (checkList(targetObjects)&&checkList(targetObjects)) {
//            whereSufix=[NSMutableString string];
//            [targetKeys enumerateObjectsUsingBlock:^(id targetKey, NSUInteger idx, BOOL *stop) {
//                id targetObject = [targetObjects objectAtIndex:idx];
//                [whereSufix appendFormat:@"%@ = %@ and ",targetKey,targetObject];
//            }];
//            if ([whereSufix hasSuffix:@"and "]) {
//                whereSufix = [NSMutableString stringWithString:[whereSufix substringToIndex:whereSufix.length-4]];
//            }
//        }
//        // NSLog(@"whereSufix:%@",whereSufix);
//        
//        BOOL cached =NO;
//        if (whereSufix) {
//            NSString *sql=[NSString stringWithFormat:@"select * from %@ where %@",tableName,whereSufix];
//            FMResultSet *result=[db executeQuery:sql];
//            if ([result next]) {
//                cached =YES;
//            }
//            [result close];
//        }
//        else{
//            NSString *sql=[NSString stringWithFormat:@"select * from %@",tableName];
//            FMResultSet *result=[db executeQuery:sql];
//            if ([result next]) {
//                cached =YES;
//            }
//            [result close];
//        }
//        // NSLog(@"cached:%d",cached);
//        if (cached) {
//            NSString *SQL_update=nil;
//            if (whereSufix) {
//                SQL_update=[NSString stringWithFormat:@"%@ where %@",updatePrefix,whereSufix];
//            }
//            else{
//                SQL_update=updatePrefix;
//            }
//            //NSLog(@"SQL_update:%@",SQL_update);
//            [db executeUpdate:SQL_update withArgumentsInArray:objects];
//            //NSLog(@"update:%d",update);
//        }
//        else{
//            //NSLog(@"SQL_insertPrefix:%@",SQL_insertPrefix);
//            [db executeUpdate:insertString withArgumentsInArray:objects];
//            //NSLog(@"insert:%d",insert);
//            
//        }
//    }];
//}
//3
//+(void)saveSQLwithSQLKeys:(NSArray *)sqlKeys objects:(NSArray *)objects tableName:(NSString *)tableName targetKeys:(NSArray *)targetKeys targetObjects:(NSArray *)targetObjects db:(FMDatabase *)db{
//    //NSLog(@"sqlKeys:%@,objects:%@,tableName:%@,targetKeys:%@,targetObjects:%@",sqlKeys,objects,tableName,targetKeys,targetObjects);
//    if (!db) {
//        return;
//    }
//    
//    if (!checkList(objects) ){
//        return;
//    }
//    
//    NSDictionary *SQL_statements=[Tool getSQLSatatementsWithSQLKeys:sqlKeys tableName:tableName];
//    
//    NSString *updatePrefix=SQL_statements[SQLKey_UpdatePrefix];
//    NSString *insertString=SQL_statements[SQLKey_FullInsert];
//    if (!checkString(updatePrefix) || !checkString(insertString)) {
//        return;
//    }
//    
//    
//    NSMutableString *whereSufix =nil;
//    
//    if (checkList(targetKeys)&&checkList(targetObjects)) {
//        whereSufix=[NSMutableString string];
//        [targetKeys enumerateObjectsUsingBlock:^(id targetKey, NSUInteger idx, BOOL *stop) {
//            id targetObject = [targetObjects objectAtIndex:idx];
//            [whereSufix appendFormat:@"%@ = %@ and ",targetKey,targetObject];
//        }];
//        if ([whereSufix hasSuffix:@"and "]) {
//            whereSufix = [NSMutableString stringWithString:[whereSufix substringToIndex:whereSufix.length-4]];
//        }
//    }
//    // NSLog(@"whereSufix:%@",whereSufix);
//    
//    BOOL cached =NO;
//    if (whereSufix) {
//        NSString *sql=[NSString stringWithFormat:@"select * from %@ where %@",tableName,whereSufix];
//        FMResultSet *result=[db executeQuery:sql];
//        if ([result next]) {
//            cached =YES;
//        }
//        [result close];
//    }
//    else{
//        NSString *sql=[NSString stringWithFormat:@"select * from %@",tableName];
//        FMResultSet *result=[db executeQuery:sql];
//        if ([result next]) {
//            cached =YES;
//        }
//        [result close];
//    }
//    
//    // NSLog(@"cached:%d",cached);
//    
//    if (cached) {
//        NSString *SQL_update=nil;
//        if (whereSufix) {
//            SQL_update=[NSString stringWithFormat:@"%@ where %@",updatePrefix,whereSufix];
//        }
//        else{
//            SQL_update=updatePrefix;
//        }
//        //NSLog(@"SQL_update:%@\nobjects:%@",SQL_update,objects);
//        //BOOL update=
//        [db executeUpdate:SQL_update withArgumentsInArray:objects];
//        
//       // NSLog(@"update:%d",update);
//    }
//    else{
//        //NSLog(@"insertString:%@\nobjects:%@",insertString,objects);
//        //BOOL insert =
//        [db executeUpdate:insertString withArgumentsInArray:objects];
//        //NSLog(@"insert:%d",insert);
//    }
//}
////4
//+(NSMutableDictionary *)saveSQLWithApikeys:(NSArray *)apikeys tablename:(NSString *)tablename mainAPIkey:(NSString *)mainAPIkey mainSQLkey:(NSString *)mainSQLkey updatePrefix:(NSString *)updatePrefix insertString:(NSString *)insertString fmdb:(FMDatabase *)db itemDiction:(NSDictionary *)itemDiction mainValue:(NSString *)mainServerValue writeType:(WriteType *)writeType{
//    
//    if (!checkList(apikeys) || !checkString(updatePrefix) || !checkString(insertString) || !checkString(mainAPIkey) || !checkString(mainSQLkey) || !checkString(tablename)) {
//        return nil;
//    }
//    if (!checkValue(mainServerValue)) {
//        mainServerValue = [itemDiction objectForKey:mainAPIkey];
//        if (!checkValue(mainServerValue)) {
//            return nil;
//        }
//        else{
//            mainServerValue=getSafeStringWithObject(mainServerValue);
//        }
//    }
//    NSMutableDictionary *resultData=[NSMutableDictionary dictionaryWithCapacity:itemDiction.count];
//
//    NSDictionary *data_locol=nil;
//    NSString *targetId_locol=nil;
//    NSString *locolSQL=[NSString stringWithFormat:@"select * from %@ where %@ = %@",tablename,mainSQLkey,mainServerValue];
//    FMResultSet *result=[db executeQuery:locolSQL];
//    if ([result next]) {
//        data_locol=result.resultDictionary;
//    }
//    [result close];
//    
//    if (checkDict(data_locol)) {
//        targetId_locol =[data_locol valueForKey:mainSQLkey];
//        [resultData addEntriesFromDictionary:data_locol];
//    }
//    
//    NSArray *values=[itemDiction objectsForKeys:apikeys notFoundMarker:[NSNull null]];
//    //NSLog(@"values :%@",values);
//    
//    if (checkValue(targetId_locol)) {
//        NSString *SQL=[NSString stringWithFormat:@"%@ where %@ = %@",updatePrefix, mainSQLkey,mainServerValue];
//        //NSLog(@"SQL_update :%@",SQL);
//        BOOL update=[db executeUpdate:SQL withArgumentsInArray:values];
//        //NSLog(@"update success:-----> :%d",update);
//        if (!update) {
//            NSLog(@"lastErrorMessage:--->%@",db.lastErrorMessage);
//        }
//    }
//    else{
//        //NSLog(@"SQL_insertPrefix :%@",insertString);
//        BOOL insert =[db executeUpdate:insertString withArgumentsInArray:values];
//        //NSLog(@"insert success ------> :%d",insert);
//        if (!insert) {
//            NSLog(@"lastErrorMessage--->%@",db.lastErrorMessage);
//        }
//    }
//    [resultData addEntriesFromDictionary:itemDiction];
//    return resultData;
//}
////5
//+(void)saveSQLWithDictionList:(NSArray *)dictionList apiKeys:(NSArray *)apiKeys tableName:(NSString *)tableName updateString:(NSString *)updatePrefixString insertString:(NSString *)insertString mainApikey:(NSString *)mainApiKey mainSQLKey:(NSString *)mainSQLKey cacheControlBlock:(BlockWithSQLDB)cacheControlBlock{
//    
//    if (!checkList(dictionList) || !checkList(apiKeys) || !checkString(updatePrefixString) || !checkString(insertString) || !checkValue(mainApiKey) ||!checkValue(mainSQLKey) ||!checkString(tableName)) {
//        return;
//    }
//    //
//    [ApplicationDelegate.dataBaseQueue inTransaction:^(FMDatabase *db, BOOL *rollback) {
//        //begain update sql-db and cache
//        [dictionList enumerateObjectsUsingBlock:^(NSDictionary *itemDiction, NSUInteger idx, BOOL *stop) {
//            if (!checkDict(itemDiction)) {
//                return ;
//            }
//            id mainValue_server = [itemDiction objectForKey:mainApiKey];
//            //NSLog(@"itemDiction:%@",itemDiction);
//            if (!checkValue(mainValue_server)) {
//                return ;
//            }
//            else{
//                mainValue_server =getSafeStringWithObject(mainValue_server);
//            }
//            
//            WriteType writeType=WriteType_insert;
//            
//            NSDictionary *resultData = [self saveSQLWithApikeys:apiKeys tablename:tableName mainAPIkey:mainApiKey mainSQLkey:mainSQLKey updatePrefix:updatePrefixString insertString:insertString fmdb:db itemDiction:itemDiction mainValue:mainValue_server writeType:&writeType];
//            //NSLog(@"itemdiction:%@",itemDiction);
//            if (cacheControlBlock) {
//                cacheControlBlock(resultData,db,mainValue_server,idx,writeType);
//            }
//        }];
//    }];
//}
////6
//+(void)saveSQLWithDictionList:(NSArray *)dictionList apiKeys:(NSArray *)apiKeys sqlKeys:(NSArray *)sqlKeys tableName:(NSString *)tableName mainApikey:(NSString *)mainApiKey mainSQLKey:(NSString *)mainSQLKey cacheControlBlock:(BlockWithSQLDB)cacheControlBlock{
//
//    NSDictionary *SQL_statements=[Tool getSQLSatatementsWithSQLKeys:sqlKeys tableName:tableName];
//    
//    NSString *updatePrefix=SQL_statements[SQLKey_UpdatePrefix];
//    NSString *insertString=SQL_statements[SQLKey_FullInsert];
//    if (!checkString(updatePrefix) || !checkString(insertString)) {
//        return;
//    }
//    
//    [self saveSQLWithDictionList:dictionList apiKeys:apiKeys tableName:tableName updateString:updatePrefix insertString:insertString mainApikey:mainApiKey mainSQLKey:mainSQLKey cacheControlBlock:cacheControlBlock];
//}
////7
//+(void)saveSQLWithDictionList:(NSArray *)dictionList apiKeys:(NSArray *)apiKeys sqlKeys:(NSArray *)sqlKeys tableName:(NSString *)tableName mainApikey:(NSString *)mainApiKey mainSQLKey:(NSString *)mainSQLKey rowKey:(NSString *)rowKey startRow:(int)startRow jsonKeys:(NSArray *)jsonKeys cacheControlBlock:(BlockWithSQLDB)cacheControlBlock{
//    //获得输出和插入的sql语句
//    NSDictionary *SQL_statements=[Tool getSQLSatatementsWithSQLKeys:sqlKeys tableName:tableName];
//    //取出语句
//    NSString *updatePrefix=SQL_statements[SQLKey_UpdatePrefix];
//    NSString *insertString=SQL_statements[SQLKey_FullInsert];
//    if (!checkString(updatePrefix) || !checkString(insertString)) {
//        return;
//    }
//    
//    [self saveSQLWithDictionList:dictionList apiKeys:apiKeys tableName:tableName updateString:updatePrefix insertString:insertString mainApikey:mainApiKey mainSQLKey:mainSQLKey rowKey:rowKey startRow:startRow jsonKeys:jsonKeys cacheControlBlock:cacheControlBlock];
//}
//
////8,主要对rowKeys和json字符串出路
//+(void)saveSQLWithDictionList:(NSArray *)dictionList apiKeys:(NSArray *)apiKeys tableName:(NSString *)tableName updateString:(NSString *)updatePrefixString insertString:(NSString *)insertString mainApikey:(NSString *)mainApiKey mainSQLKey:(NSString *)mainSQLKey rowKey:(NSString *)rowKey startRow:(int)startRow jsonKeys:(NSArray *)jsonKeys cacheControlBlock:(BlockWithSQLDB)cacheControlBlock{
//    // NSLog(@"tableName:%@",tableName);
//    [Tool saveSQLWithDictionList:dictionList apiKeys:apiKeys tableName:tableName updateString:updatePrefixString insertString:insertString mainApikey:mainApiKey mainSQLKey:mainSQLKey cacheControlBlock:^(id itemDiction, FMDatabase *db, id currentMainValue, int idx,WriteType writeType) {
//        //如果rowKey不为空
//        if (checkString(rowKey)) {
//            //构建sql语句
//            NSString *SQL=[NSString stringWithFormat:@"update %@ set %@ = ? where %@ = %@",tableName,rowKey,mainSQLKey,currentMainValue];
//            //  NSLog(@"indexSQL:%@",indexSQL);
//            //更新
//            [db executeUpdate:SQL,@(startRow+idx)];
//            // NSLog(@"updateIndex:%d",updateIndex)
//        }
//        //jsonKeys为非空数组
//        if (checkList(jsonKeys)) {
//            //遍历jsonkeys
//            [jsonKeys enumerateObjectsUsingBlock:^(NSString *jsonKey, NSUInteger idx, BOOL *stop) {
//                id jsonString =nil;
//                
//                id toJsonValue = [itemDiction objectForKey:jsonKey];
//                if (checkValue(toJsonValue)) {
//                    if (checkString(toJsonValue)) {
//                        jsonString=toJsonValue;
//                    }
//                    else{
//                        jsonString =[toJsonValue JSONRepresentation];
//                    }
//                    
//                    if (!checkString(jsonString)) {
//                        jsonString=[NSNull null];
//                    }
//                }
//                //构建sql语句
//                NSString *SQL=[NSString stringWithFormat:@"update %@ set %@ = ? where %@ = %@",tableName,jsonKey,mainSQLKey,currentMainValue];
//                //NSLog(@"------>SQL:%@",SQL);
//                BOOL updateJsonKey=[db executeUpdate:SQL,jsonString];
//                //NSLog(@"updateJsonKey:%d",updateJsonKey);
//                //如果更新不成功
//                if (!updateJsonKey) {
//                    NSLog(@"lastErrorMessage:%@",db.lastErrorMessage);
//                }
//            }];
//        }
//        
//        //NSLog(@"itemdiction:%@",itemDiction);
//        //调用block
//        if (cacheControlBlock) {
//            cacheControlBlock(itemDiction,db,currentMainValue,idx,writeType);
//        }
//    }];
//}
////9
//+(void)saveSQLWithDictionList:(NSArray *)dictionList apiKeys:(NSArray *)apiKeys sqlKeys:(NSArray *)sqlKeys mainAPIKey:(id)mainAPIKey mainSQLKey:(id)mainSQLKey specialKey:(id)specialKey specialValue:(id)specialValue tableName:(NSString *)tableName keyCacheArray:(NSMutableArray *)keyCacheArray cacheKey:(NSString *)cacheKey cacheData:(id)cacheData loadType:(LoadType)loadtype{
//    if (!checkList(dictionList)) {
//        return;
//    }
//    if (!checkList(sqlKeys) && !checkList(apiKeys)) {
//        sqlKeys =[[dictionList lastObject]allKeys];
//        apiKeys =sqlKeys;
//    }
//    
//    
//    [Tool saveSQLWithDictionList:dictionList apiKeys:apiKeys sqlKeys:sqlKeys tableName:tableName mainApikey:mainAPIKey mainSQLKey:mainSQLKey cacheControlBlock:^(id itemDiction, FMDatabase *db, id currentMainValue, int idx,WriteType writeType) {
//        //get keyCache
//        id cacheValue_server=nil;
//        if (cacheKey) {
//            cacheValue_server=[itemDiction objectForKey:cacheKey];
//            if (!checkValue(cacheValue_server)) {
//                //return ;
//            }
//            else{
//                cacheValue_server = getSafeStringWithObject(cacheValue_server);
//            }
//        }
//        
//        //NSLog(@"cacheValue_server:----->%@",cacheValue_server);
//        //update key-cacheArray
//        if (![keyCacheArray containsObject:cacheValue_server] && cacheValue_server) {
//            if (loadtype==LoadType_refreshNew) {
//                [keyCacheArray insertObject:cacheValue_server atIndex:idx];
//            }
//            else if(loadtype==LoadType_loadMore){
//                [keyCacheArray addObject:cacheValue_server];
//            }
//        }
//        
//        //update key-calue-cache
//        if (checkValue(cacheData)&&cacheKey) {
//            id targetCacheValue = [itemDiction objectForKey:cacheKey];
//            if (targetCacheValue) {
//                NSMutableDictionary *cachedDiction = [cacheData objectForKey:targetCacheValue];
//                if (!cachedDiction) {
//                    cacheData[targetCacheValue]=itemDiction;
//                }
//                else{
//                    [cachedDiction addEntriesFromDictionary:itemDiction];
//                }
//                
//                if (specialValue && specialKey) {
//                    [cachedDiction setValue:specialValue forKey:specialKey];
//                }
//            }
//        }
//        
//        //specialUpdate
//        if (specialKey && specialValue) {
//            NSString *SQL =[NSString stringWithFormat:@"update %@ set %@ = ? where %@ = %@",tableName,specialKey,mainSQLKey,currentMainValue];
//            [db executeUpdate:SQL,specialValue];
//        }
//        
//    }];
//}


//#pragma mark - DeleteSQL
//+(void)deleteSQLDataWithTableName:(NSString *)tableName targetKey:(id)targetKey targetObject:(id)targetObject{
//    [ApplicationDelegate.dataBaseQueue inDatabase:^(FMDatabase *db) {
//        NSString *SQL =[NSString stringWithFormat:@"delete from %@ where %@ = %@",tableName,targetKey,targetObject];
//        [db executeUpdate:SQL];
//        //NSLog(@"delete tableName:%@  success:--->%d",tableName,delete);
//    }];
//}
//+(void)deleteSQLDatasWithTableName:(NSString *)tableName targetKeys:(id)targetKeys targetObjects:(id)targetObjects{
//    NSMutableString *whereSufix =nil;
//    
//    if (checkList(targetKeys)&&checkList(targetObjects)) {
//        whereSufix=[NSMutableString string];
//        [targetKeys enumerateObjectsUsingBlock:^(id targetKey, NSUInteger idx, BOOL *stop) {
//            id targetObject = [targetObjects objectAtIndex:idx];
//            [whereSufix appendFormat:@"%@ = %@ and ",targetKey,targetObject];
//        }];
//        if ([whereSufix hasSuffix:@"and "]) {
//            whereSufix = [NSMutableString stringWithString:[whereSufix substringToIndex:whereSufix.length-4]];
//        }
//    }
//
//    
//    [ApplicationDelegate.dataBaseQueue inDatabase:^(FMDatabase *db) {
//        NSString *SQL =[NSString stringWithFormat:@"delete from %@ where %@",tableName,whereSufix];
//        BOOL delete= [db executeUpdate:SQL];
//        NSLog(@"delete tableName:%@  success:--->%d",tableName,delete);
//    }];
//}
//+(void)deleteSQLDataWithTableName:(NSString *)tableName{
//    [ApplicationDelegate.dataBaseQueue inDatabase:^(FMDatabase *db) {
//        NSString *SQL =[NSString stringWithFormat:@"delete from %@",tableName];
//        [db executeUpdate:SQL];
//        // NSLog(@"delete tableName:%@  success:--->%d",tableName,delete);
//    }];
//}
#pragma mark - Data Checker & Transfer


+(BOOL)checkPushCenterAvailable{
    UIRemoteNotificationType types = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
    if (types == UIRemoteNotificationTypeNone){
        return NO;;
    }
    else{
        return YES;
    }
}
+(float)convertbyte:(int)byte isMb:(BOOL)isMb
{
    float fByte = 0.0f;
    
    if (byte > 1024 )
    {
        //Kilobytes
        fByte = byte / 1024;
    }
    
    if (isMb)
    {
        //Megabytes
        fByte = fByte / 1024;
    }
    
    return fByte;
}
id JsonStringToObjectWithString(NSString *responseString){
    
    id jsonDict = nil;
    if (responseString == nil || responseString.length == 0) return nil;
    
    jsonDict = [responseString objectFromJSONStringWithParseOptions:JKParseOptionLooseUnicode];//JSONKit
    if (jsonDict == nil) {
        jsonDict = [responseString JSONValue];//SBJson
        
    }
    return jsonDict;
}
+(NSString *)getSafeUrlStrWithStr:(NSString *)urlStr{
    if (![urlStr hasPrefix:@"http://"] && ![urlStr hasPrefix:@"https://"]) {
        urlStr=[NSString stringWithFormat:@"http://%@",urlStr];
    }
    return urlStr;
}

+ (NSString *)messageTimeFormat:(NSTimeInterval)pubTime {
	if (!pubTime || pubTime == 0) {
		NSLog(@"日期错误");
        return @"";
        
	}
	
	NSDate *pub = [NSDate dateWithTimeIntervalSince1970:pubTime];
    
	NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
	[formatter setDateFormat:@"YYYY.MM.dd"];
	NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
	[formatter setTimeZone:timeZone];
	NSString *dateString = [formatter stringFromDate:pub];
	
	return dateString;
}
+ (NSString *)messageTimeAndDayFormat:(NSTimeInterval)pubTime {
	if (!pubTime || pubTime == 0) {
         NSLog(@"日期错误");
		return @"";
	}
	
	NSDate *pub = [NSDate dateWithTimeIntervalSince1970:pubTime];
    
	NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
	[formatter setDateFormat:@"YYYY.MM.dd.HH:mm"];
	NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
	[formatter setTimeZone:timeZone];
	NSString *dateString = [formatter stringFromDate:pub];
	
	return dateString;
}
+ (NSString *)calculatepastTime:(NSTimeInterval)pubTime {
	if (!pubTime || pubTime == 0) {
        NSLog(@"日期错误");
		return @"";
	}
	
	NSDate *now = [NSDate date];
	NSDate *pub = [NSDate dateWithTimeIntervalSince1970:pubTime];
	NSCalendar *calendar = [NSCalendar currentCalendar];
	unsigned int unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
	NSDateComponents *comp = [calendar components:unitFlags fromDate:pub toDate:now options:0];
	
	int year = [comp year];
	int month = [comp month];
	int day = [comp day];
	int hour = [comp hour];
	int minute = [comp minute];
	int second = [comp second];
	//NSLog(@"year:%d month:%d day:%d hour:%d minute:%d second:%d",year,month,day,hour,minute,second);
    
	if (year > 0) {
		return [NSString stringWithFormat:@"%d年前",year];
	}
	
	if (month > 0) {
		return [NSString stringWithFormat:@"%d月前",month];
	}
	
	if (day > 0) {
		return [NSString stringWithFormat:@"%d天前",day];
	}
	
	if (hour > 0) {
		return [NSString stringWithFormat:@"%d小时前",hour];
	}
	
	if (minute > 0) {
		return [NSString stringWithFormat:@"%d分钟前",minute];
	}
	
	if (second > 0) {
		return [NSString stringWithFormat:@"%d秒前",second];
	}
	
    NSLog(@"日期错误");
    
	return @"";
}

#pragma mark - Emoji Souce

+ (NSArray *)ios4EmojiArray {
    NSArray *arr = [[NSArray alloc] initWithObjects:@"\uE415",@"\uE056",@"\uE057",@"\uE414",@"\uE405",@"\uE106",@"\uE418",@"\uE417",@"\uE40D",@"\uE40A",@"\uE404",@"\uE105",@"\uE409",@"\uE40E",@"\uE402",@"\uE108",@"\uE403",@"\uE058",@"\uE407",@"\uE401",@"\uE40F",@"\uE40B",@"\uE406",@"\uE413",@"\uE411",@"\uE412",@"\uE410",@"\uE107",@"\uE059",@"\uE416",@"\uE408",@"\uE40C",@"\uE11A",@"\uE10C",@"\uE32C",@"\uE32A",@"\uE32D",@"\uE328",@"\uE32B",@"\uE022",@"\uE023",@"\uE327",@"\uE329",@"\uE32E",@"\uE335",@"\uE334",@"\uE337",@"\uE336",@"\uE13C",@"\uE330",@"\uE331",@"\uE326",@"\uE03E",@"\uE11D",@"\uE05A",@"\uE00E",@"\uE421",@"\uE420",@"\uE00D",@"\uE010",@"\uE011",@"\uE41E",@"\uE012",@"\uE422",@"\uE22E",@"\uE22F",@"\uE231",@"\uE230",@"\uE427",@"\uE41D",@"\uE00F",@"\uE41F",@"\uE14C",@"\uE201",@"\uE115",@"\uE428",@"\uE51F",@"\uE429",@"\uE424",@"\uE423",@"\uE253",@"\uE426",@"\uE111",@"\uE425",@"\uE31E",@"\uE31F",@"\uE31D",@"\uE001",@"\uE002",@"\uE005",@"\uE004",@"\uE51A",@"\uE519",@"\uE518",@"\uE515",@"\uE516",@"\uE517",@"\uE51B",@"\uE152",@"\uE04E",@"\uE51C",@"\uE51E",@"\uE11C",@"\uE536",@"\uE003",@"\uE41C",@"\uE41B",@"\uE419",@"\uE41A",@"\uE436",@"\uE437",@"\uE438",@"\uE43A",@"\uE439",@"\uE43B",@"\uE117",@"\uE440",@"\uE442",@"\uE446",@"\uE445",@"\uE11B",@"\uE448",@"\uE033",@"\uE112",@"\uE325",@"\uE312",@"\uE310",@"\uE126",@"\uE127",@"\uE008",@"\uE03D",@"\uE00C",@"\uE12A",@"\uE00A",@"\uE00B",@"\uE009",@"\uE316",@"\uE129",@"\uE141",@"\uE142",@"\uE317",@"\uE128",@"\uE14B",@"\uE211",@"\uE114",@"\uE145",@"\uE144",@"\uE03F",@"\uE313",@"\uE116",@"\uE10F",@"\uE104",@"\uE103",@"\uE101",@"\uE102",@"\uE13F",@"\uE140",@"\uE11F",@"\uE12F",@"\uE031",@"\uE30E",@"\uE311",@"\uE113",@"\uE30F",@"\uE13B",@"\uE42B",@"\uE42A",@"\uE018",@"\uE016",@"\uE015",@"\uE014",@"\uE42C",@"\uE42D",@"\uE017",@"\uE013",@"\uE20E",@"\uE20C",@"\uE20F",@"\uE20D",@"\uE131",@"\uE12B",@"\uE130",@"\uE12D",@"\uE324",@"\uE301",@"\uE148",@"\uE502",@"\uE03C",@"\uE30A",@"\uE042",@"\uE040",@"\uE041",@"\uE12C",@"\uE007",@"\uE31A",@"\uE13E",@"\uE31B",@"\uE006",@"\uE302",@"\uE319",@"\uE321",@"\uE322",@"\uE314",@"\uE503",@"\uE10E",@"\uE318",@"\uE43C",@"\uE11E",@"\uE323",@"\uE31C",@"\uE034",@"\uE035",@"\uE045",@"\uE338",@"\uE047",@"\uE30C",@"\uE044",@"\uE30B",@"\uE043",@"\uE120",@"\uE33B",@"\uE33F",@"\uE341",@"\uE34C",@"\uE344",@"\uE342",@"\uE33D",@"\uE33E",@"\uE340",@"\uE34D",@"\uE339",@"\uE147",@"\uE343",@"\uE33C",@"\uE33A",@"\uE43F",@"\uE34B",@"\uE046",@"\uE345",@"\uE346",@"\uE348",@"\uE347",@"\uE34A",@"\uE349",@"\uE04A",@"\uE04B",@"\uE049",@"\uE048",@"\uE04C",@"\uE13D",@"\uE443",@"\uE43E",@"\uE04F",@"\uE052",@"\uE053",@"\uE524",@"\uE52C",@"\uE52A",@"\uE531",@"\uE050",@"\uE527",@"\uE051",@"\uE10B",@"\uE52B",@"\uE52F",@"\uE109",@"\uE528",@"\uE01A",@"\uE134",@"\uE530",@"\uE529",@"\uE526",@"\uE52D",@"\uE521",@"\uE523",@"\uE52E",@"\uE055",@"\uE525",@"\uE10A",@"\uE522",@"\uE019",@"\uE054",@"\uE520",@"\uE306",@"\uE030",@"\uE304",@"\uE110",@"\uE032",@"\uE305",@"\uE303",@"\uE118",@"\uE447",@"\uE119",@"\uE307",@"\uE308",@"\uE444",@"\uE441",@"\uE21C",@"\uE21D",@"\uE21E",@"\uE21F",@"\uE220",@"\uE221",@"\uE222",@"\uE223",@"\uE224",@"\uE225",@"\uE210",@"\uE232",@"\uE233",@"\uE235",@"\uE234",@"\uE236",@"\uE237",@"\uE238",@"\uE239",@"\uE23B",@"\uE23A",@"\uE23D",@"\uE23C",@"\uE24D",@"\uE212",@"\uE24C",@"\uE213",@"\uE214",@"\uE507",@"\uE203",@"\uE20B",@"\uE22A",@"\uE22B",@"\uE226",@"\uE227",@"\uE22C",@"\uE22D",@"\uE215",@"\uE216",@"\uE217",@"\uE218",@"\uE228",@"\uE151",@"\uE138",@"\uE139",@"\uE13A",@"\uE208",@"\uE14F",@"\uE20A",@"\uE434",@"\uE309",@"\uE315",@"\uE30D",@"\uE207",@"\uE229",@"\uE206",@"\uE205",@"\uE204",@"\uE12E",@"\uE250",@"\uE251",@"\uE14A",@"\uE149",@"\uE23F",@"\uE240",@"\uE241",@"\uE242",@"\uE243",@"\uE244",@"\uE245",@"\uE246",@"\uE247",@"\uE248",@"\uE249",@"\uE24A",@"\uE24B",@"\uE23E",@"\uE532",@"\uE533",@"\uE534",@"\uE535",@"\uE21A",@"\uE219",@"\uE21B",@"\uE02F",@"\uE024",@"\uE025",@"\uE026",@"\uE027",@"\uE028",@"\uE029",@"\uE02A",@"\uE02B",@"\uE02C",@"\uE02D",@"\uE02E",@"\uE332",@"\uE333",@"\uE24E",@"\uE24F",@"\uE537",@"\uE036",@"\uE157",@"\uE038",@"\uE153",@"\uE155",@"\uE14D",@"\uE156",@"\uE501",@"\uE158",@"\uE43D",@"\uE037",@"\uE504",@"\uE44A",@"\uE146",@"\uE154",@"\uE505",@"\uE506",@"\uE122",@"\uE508",@"\uE509",@"\uE03B",@"\uE04D",@"\uE449",@"\uE44B",@"\uE51D",@"\uE44C",@"\uE124",@"\uE121",@"\uE433",@"\uE202",@"\uE135",@"\uE01C",@"\uE01D",@"\uE10D",@"\uE136",@"\uE42E",@"\uE01B",@"\uE15A",@"\uE159",@"\uE432",@"\uE430",@"\uE431",@"\uE42F",@"\uE01E",@"\uE039",@"\uE435",@"\uE01F",@"\uE125",@"\uE03A",@"\uE14E",@"\uE252",@"\uE137",@"\uE209",@"\uE133",@"\uE150",@"\uE320",@"\uE123",@"\uE132",@"\uE143",@"\uE50B",@"\uE514",@"\uE513",@"\uE50C",@"\uE50D",@"\uE511",@"\uE50F",@"\uE512",@"\uE510",@"\uE50E", nil];
    
    return arr;
}
+ (NSArray *)ios5EmojiArray {
    NSArray *arr = [[NSArray alloc] initWithObjects:@"\xF0\x9F\x98\x84",@"\xF0\x9F\x98\x8A",@"\xF0\x9F\x98\x83",@"\xE2\x98\xBA",@"\xF0\x9F\x98\x89",@"\xF0\x9F\x98\x8D",@"\xF0\x9F\x98\x98",@"\xF0\x9F\x98\x9A",@"\xF0\x9F\x98\xB3",@"\xF0\x9F\x98\x8C",@"\xF0\x9F\x98\x81",@"\xF0\x9F\x98\x9C",@"\xF0\x9F\x98\x9D",@"\xF0\x9F\x98\x92",@"\xF0\x9F\x98\x8F",@"\xF0\x9F\x98\x93",@"\xF0\x9F\x98\x94",@"\xF0\x9F\x98\x9E",@"\xF0\x9F\x98\x96",@"\xF0\x9F\x98\xA5",@"\xF0\x9F\x98\xB0",@"\xF0\x9F\x98\xA8",@"\xF0\x9F\x98\xA3",@"\xF0\x9F\x98\xA2",@"\xF0\x9F\x98\xAD",@"\xF0\x9F\x98\x82",@"\xF0\x9F\x98\xB2",@"\xF0\x9F\x98\xB1",@"\xF0\x9F\x98\xA0",@"\xF0\x9F\x98\xA1",@"\xF0\x9F\x98\xAA",@"\xF0\x9F\x98\xB7",@"\xF0\x9F\x91\xBF",@"\xF0\x9F\x91\xBD",@"\xF0\x9F\x92\x9B",@"\xF0\x9F\x92\x99",@"\xF0\x9F\x92\x9C",@"\xF0\x9F\x92\x97",@"\xF0\x9F\x92\x9A",@"\xE2\x9D\xA4",@"\xF0\x9F\x92\x94",@"\xF0\x9F\x92\x93",@"\xF0\x9F\x92\x98",@"\xE2\x9C\xA8",@"\xF0\x9F\x8C\x9F",@"\xF0\x9F\x92\xA2",@"\xE2\x9D\x95",@"\xE2\x9D\x94",@"\xF0\x9F\x92\xA4",@"\xF0\x9F\x92\xA8",@"\xF0\x9F\x92\xA6",@"\xF0\x9F\x8E\xB6",@"\xF0\x9F\x8E\xB5",@"\xF0\x9F\x94\xA5",@"\xF0\x9F\x92\xA9",@"\xF0\x9F\x91\x8D",@"\xF0\x9F\x91\x8E",@"\xF0\x9F\x91\x8C",@"\xF0\x9F\x91\x8A",@"\xE2\x9C\x8A",@"\xE2\x9C\x8C",@"\xF0\x9F\x91\x8B",@"\xE2\x9C\x8B",@"\xF0\x9F\x91\x90",@"\xF0\x9F\x91\x86",@"\xF0\x9F\x91\x87",@"\xF0\x9F\x91\x89",@"\xF0\x9F\x91\x88",@"\xF0\x9F\x99\x8C",@"\xF0\x9F\x99\x8F",@"\xE2\x98\x9D",@"\xF0\x9F\x91\x8F",@"\xF0\x9F\x92\xAA",@"\xF0\x9F\x9A\xB6",@"\xF0\x9F\x8F\x83",@"\xF0\x9F\x91\xAB",@"\xF0\x9F\x92\x83",@"\xF0\x9F\x91\xAF",@"\xF0\x9F\x99\x86",@"\xF0\x9F\x99\x85",@"\xF0\x9F\x92\x81",@"\xF0\x9F\x99\x87",@"\xF0\x9F\x92\x8F",@"\xF0\x9F\x92\x91",@"\xF0\x9F\x92\x86",@"\xF0\x9F\x92\x87",@"\xF0\x9F\x92\x85",@"\xF0\x9F\x91\xA6",@"\xF0\x9F\x91\xA7",@"\xF0\x9F\x91\xA9",@"\xF0\x9F\x91\xA8",@"\xF0\x9F\x91\xB6",@"\xF0\x9F\x91\xB5",@"\xF0\x9F\x91\xB4",@"\xF0\x9F\x91\xB1",@"\xF0\x9F\x91\xB2",@"\xF0\x9F\x91\xB3",@"\xF0\x9F\x91\xB7",@"\xF0\x9F\x91\xAE",@"\xF0\x9F\x91\xBC",@"\xF0\x9F\x91\xB8",@"\xF0\x9F\x92\x82",@"\xF0\x9F\x92\x80",@"\xF0\x9F\x91\xA3",@"\xF0\x9F\x92\x8B",@"\xF0\x9F\x91\x84",@"\xF0\x9F\x91\x82",@"\xF0\x9F\x91\x80",@"\xF0\x9F\x91\x83",@"\xF0\x9F\x8E\x8D",@"\xF0\x9F\x92\x9D",@"\xF0\x9F\x8E\x8E",@"\xF0\x9F\x8E\x92",@"\xF0\x9F\x8E\x93",@"\xF0\x9F\x8E\x8F",@"\xF0\x9F\x8E\x86",@"\xF0\x9F\x8E\x87",@"\xF0\x9F\x8E\x90",@"\xF0\x9F\x8E\x91",@"\xF0\x9F\x8E\x83",@"\xF0\x9F\x91\xBB",@"\xF0\x9F\x8E\x85",@"\xF0\x9F\x8E\x84",@"\xF0\x9F\x8E\x81",@"\xF0\x9F\x94\x94",@"\xF0\x9F\x8E\x89",@"\xF0\x9F\x8E\x88",@"\xF0\x9F\x92\xBF",@"\xF0\x9F\x93\x80",@"\xF0\x9F\x93\xB7",@"\xF0\x9F\x8E\xA5",@"\xF0\x9F\x92\xBB",@"\xF0\x9F\x93\xBA",@"\xF0\x9F\x93\xB1",@"\xF0\x9F\x93\xA0",@"\xE2\x98\x8E",@"\xF0\x9F\x92\xBD",@"\xF0\x9F\x93\xBC",@"\xF0\x9F\x94\x8A",@"\xF0\x9F\x93\xA2",@"\xF0\x9F\x93\xA3",@"\xF0\x9F\x93\xBB",@"\xF0\x9F\x93\xA1",@"\xE2\x9E\xBF",@"\xF0\x9F\x94\x8D",@"\xF0\x9F\x94\x93",@"\xF0\x9F\x94\x92",@"\xF0\x9F\x94\x91",@"\xE2\x9C\x82",@"\xF0\x9F\x94\xA8",@"\xF0\x9F\x92\xA1",@"\xF0\x9F\x93\xB2",@"\xF0\x9F\x93\xA9",@"\xF0\x9F\x93\xAB",@"\xF0\x9F\x93\xAE",@"\xF0\x9F\x9B\x80",@"\xF0\x9F\x9A\xBD",@"\xF0\x9F\x92\xBA",@"\xF0\x9F\x92\xB0",@"\xF0\x9F\x94\xB1",@"\xF0\x9F\x9A\xAC",@"\xF0\x9F\x92\xA3",@"\xF0\x9F\x94\xAB",@"\xF0\x9F\x92\x8A",@"\xF0\x9F\x92\x89",@"\xF0\x9F\x8F\x88",@"\xF0\x9F\x8F\x80",@"\xE2\x9A\xBD",@"\xE2\x9A\xBE",@"\xF0\x9F\x8E\xBE",@"\xE2\x9B\xB3",@"\xF0\x9F\x8E\xB1",@"\xF0\x9F\x8F\x8A",@"\xF0\x9F\x8F\x84",@"\xF0\x9F\x8E\xBF",@"\xE2\x99\xA0",@"\xE2\x99\xA5",@"\xE2\x99\xA3",@"\xE2\x99\xA6",@"\xF0\x9F\x8F\x86",@"\xF0\x9F\x91\xBE",@"\xF0\x9F\x8E\xAF",@"\xF0\x9F\x80\x84",@"\xF0\x9F\x8E\xAC",@"\xF0\x9F\x93\x9D",@"\xF0\x9F\x93\x96",@"\xF0\x9F\x8E\xA8",@"\xF0\x9F\x8E\xA4",@"\xF0\x9F\x8E\xA7",@"\xF0\x9F\x8E\xBA",@"\xF0\x9F\x8E\xB7",@"\xF0\x9F\x8E\xB8",@"\xE3\x80\xBD",@"\xF0\x9F\x91\x9F",@"\xF0\x9F\x91\xA1",@"\xF0\x9F\x91\xA0",@"\xF0\x9F\x91\xA2",@"\xF0\x9F\x91\x95",@"\xF0\x9F\x91\x94",@"\xF0\x9F\x91\x97",@"\xF0\x9F\x91\x98",@"\xF0\x9F\x91\x99",@"\xF0\x9F\x8E\x80",@"\xF0\x9F\x8E\xA9",@"\xF0\x9F\x91\x91",@"\xF0\x9F\x91\x92",@"\xF0\x9F\x8C\x82",@"\xF0\x9F\x92\xBC",@"\xF0\x9F\x91\x9C",@"\xF0\x9F\x92\x84",@"\xF0\x9F\x92\x8D",@"\xF0\x9F\x92\x8E",@"\xE2\x98\x95",@"\xF0\x9F\x8D\xB5",@"\xF0\x9F\x8D\xBA",@"\xF0\x9F\x8D\xBB",@"\xF0\x9F\x8D\xB8",@"\xF0\x9F\x8D\xB6",@"\xF0\x9F\x8D\xB4",@"\xF0\x9F\x8D\x94",@"\xF0\x9F\x8D\x9F",@"\xF0\x9F\x8D\x9D",@"\xF0\x9F\x8D\x9B",@"\xF0\x9F\x8D\xB1",@"\xF0\x9F\x8D\xA3",@"\xF0\x9F\x8D\x99",@"\xF0\x9F\x8D\x98",@"\xF0\x9F\x8D\x9A",@"\xF0\x9F\x8D\x9C",@"\xF0\x9F\x8D\xB2",@"\xF0\x9F\x8D\x9E",@"\xF0\x9F\x8D\xB3",@"\xF0\x9F\x8D\xA2",@"\xF0\x9F\x8D\xA1",@"\xF0\x9F\x8D\xA6",@"\xF0\x9F\x8D\xA7",@"\xF0\x9F\x8E\x82",@"\xF0\x9F\x8D\xB0",@"\xF0\x9F\x8D\x8E",@"\xF0\x9F\x8D\x8A",@"\xF0\x9F\x8D\x89",@"\xF0\x9F\x8D\x93",@"\xF0\x9F\x8D\x86",@"\xF0\x9F\x8D\x85",@"\xE2\x98\x80",@"\xE2\x98\x94",@"\xE2\x98\x81",@"\xE2\x9B\x84",@"\xF0\x9F\x8C\x99",@"\xE2\x9A\xA1",@"\xF0\x9F\x8C\x80",@"\xF0\x9F\x8C\x8A",@"\xF0\x9F\x90\xB1",@"\xF0\x9F\x90\xB6",@"\xF0\x9F\x90\xAD",@"\xF0\x9F\x90\xB9",@"\xF0\x9F\x90\xB0",@"\xF0\x9F\x90\xBA",@"\xF0\x9F\x90\xB8",@"\xF0\x9F\x90\xAF",@"\xF0\x9F\x90\xA8",@"\xF0\x9F\x90\xBB",@"\xF0\x9F\x90\xB7",@"\xF0\x9F\x90\xAE",@"\xF0\x9F\x90\x97",@"\xF0\x9F\x90\xB5",@"\xF0\x9F\x90\x92",@"\xF0\x9F\x90\xB4",@"\xF0\x9F\x90\x8E",@"\xF0\x9F\x90\xAB",@"\xF0\x9F\x90\x91",@"\xF0\x9F\x90\x98",@"\xF0\x9F\x90\x8D",@"\xF0\x9F\x90\xA6",@"\xF0\x9F\x90\xA4",@"\xF0\x9F\x90\x94",@"\xF0\x9F\x90\xA7",@"\xF0\x9F\x90\x9B",@"\xF0\x9F\x90\x99",@"\xF0\x9F\x90\xA0",@"\xF0\x9F\x90\x9F",@"\xF0\x9F\x90\xB3",@"\xF0\x9F\x90\xAC",@"\xF0\x9F\x92\x90",@"\xF0\x9F\x8C\xB8",@"\xF0\x9F\x8C\xB7",@"\xF0\x9F\x8D\x80",@"\xF0\x9F\x8C\xB9",@"\xF0\x9F\x8C\xBB",@"\xF0\x9F\x8C\xBA",@"\xF0\x9F\x8D\x81",@"\xF0\x9F\x8D\x83",@"\xF0\x9F\x8D\x82",@"\xF0\x9F\x8C\xB4",@"\xF0\x9F\x8C\xB5",@"\xF0\x9F\x8C\xBE",@"\xF0\x9F\x90\x9A",@"\x31\xE2\x83\xA3",@"\x32\xE2\x83\xA3",@"\x33\xE2\x83\xA3",@"\x34\xE2\x83\xA3",@"\x35\xE2\x83\xA3",@"\x36\xE2\x83\xA3",@"\x37\xE2\x83\xA3",@"\x38\xE2\x83\xA3",@"\x39\xE2\x83\xA3",@"\x30\xE2\x83\xA3",@"\x23\xE2\x83\xA3",@"\xE2\xAC\x86",@"\xE2\xAC\x87",@"\xE2\xAC\x85",@"\xE2\x9E\xA1",@"\xE2\x86\x97",@"\xE2\x86\x96",@"\xE2\x86\x98",@"\xE2\x86\x99",@"\xE2\x97\x80",@"\xE2\x96\xB6",@"\xE2\x8F\xAA",@"\xE2\x8F\xA9",@"\xF0\x9F\x86\x97",@"\xF0\x9F\x86\x95",@"\xF0\x9F\x94\x9D",@"\xF0\x9F\x86\x99",@"\xF0\x9F\x86\x92",@"\xF0\x9F\x8E\xA6",@"\xF0\x9F\x88\x81",@"\xF0\x9F\x93\xB6",@"\xF0\x9F\x88\xB5",@"\xF0\x9F\x88\xB3",@"\xF0\x9F\x89\x90",@"\xF0\x9F\x88\xB9",@"\xF0\x9F\x88\xAF",@"\xF0\x9F\x88\xBA",@"\xF0\x9F\x88\xB6",@"\xF0\x9F\x88\x9A",@"\xF0\x9F\x88\xB7",@"\xF0\x9F\x88\xB8",@"\xF0\x9F\x88\x82",@"\xF0\x9F\x9A\xBB",@"\xF0\x9F\x9A\xB9",@"\xF0\x9F\x9A\xBA",@"\xF0\x9F\x9A\xBC",@"\xF0\x9F\x9A\xAD",@"\xF0\x9F\x85\xBF",@"\xE2\x99\xBF",@"\xF0\x9F\x9A\x87",@"\xF0\x9F\x9A\xBE",@"\xE3\x8A\x99",@"\xE3\x8A\x97",@"\xF0\x9F\x94\x9E",@"\xF0\x9F\x86\x94",@"\xE2\x9C\xB3",@"\xE2\x9C\xB4",@"\xF0\x9F\x92\x9F",@"\xF0\x9F\x86\x9A",@"\xF0\x9F\x93\xB3",@"\xF0\x9F\x93\xB4",@"\xF0\x9F\x92\xB9",@"\xF0\x9F\x92\xB1",@"\xE2\x99\x88",@"\xE2\x99\x89",@"\xE2\x99\x8A",@"\xE2\x99\x8B",@"\xE2\x99\x8C",@"\xE2\x99\x8D",@"\xE2\x99\x8E",@"\xE2\x99\x8F",@"\xE2\x99\x90",@"\xE2\x99\x91",@"\xE2\x99\x92",@"\xE2\x99\x93",@"\xE2\x9B\x8E",@"\xF0\x9F\x94\xAF",@"\xF0\x9F\x85\xB0",@"\xF0\x9F\x85\xB1",@"\xF0\x9F\x86\x8E",@"\xF0\x9F\x85\xBE",@"\xF0\x9F\x94\xB2",@"\xF0\x9F\x94\xB4",@"\xF0\x9F\x94\xB3",@"\xF0\x9F\x95\x9B",@"\xF0\x9F\x95\x90",@"\xF0\x9F\x95\x91",@"\xF0\x9F\x95\x92",@"\xF0\x9F\x95\x93",@"\xF0\x9F\x95\x94",@"\xF0\x9F\x95\x95",@"\xF0\x9F\x95\x96",@"\xF0\x9F\x95\x97",@"\xF0\x9F\x95\x98",@"\xF0\x9F\x95\x99",@"\xF0\x9F\x95\x9A",@"\xE2\xAD\x95",@"\xE2\x9D\x8C",@"\xC2\xA9",@"\xC2\xAE",@"\xE2\x84\xA2",@"\xF0\x9F\x8F\xA0",@"\xF0\x9F\x8F\xAB",@"\xF0\x9F\x8F\xA2",@"\xF0\x9F\x8F\xA3",@"\xF0\x9F\x8F\xA5",@"\xF0\x9F\x8F\xA6",@"\xF0\x9F\x8F\xAA",@"\xF0\x9F\x8F\xA9",@"\xF0\x9F\x8F\xA8",@"\xF0\x9F\x92\x92",@"\xE2\x9B\xAA",@"\xF0\x9F\x8F\xAC",@"\xF0\x9F\x8C\x87",@"\xF0\x9F\x8C\x86",@"\xF0\x9F\x8F\xA7",@"\xF0\x9F\x8F\xAF",@"\xF0\x9F\x8F\xB0",@"\xE2\x9B\xBA",@"\xF0\x9F\x8F\xAD",@"\xF0\x9F\x97\xBC",@"\xF0\x9F\x97\xBB",@"\xF0\x9F\x8C\x84",@"\xF0\x9F\x8C\x85",@"\xF0\x9F\x8C\x83",@"\xF0\x9F\x97\xBD",@"\xF0\x9F\x8C\x88",@"\xF0\x9F\x8E\xA1",@"\xE2\x9B\xB2",@"\xF0\x9F\x8E\xA2",@"\xF0\x9F\x9A\xA2",@"\xF0\x9F\x9A\xA4",@"\xE2\x9B\xB5",@"\xE2\x9C\x88",@"\xF0\x9F\x9A\x80",@"\xF0\x9F\x9A\xB2",@"\xF0\x9F\x9A\x99",@"\xF0\x9F\x9A\x97",@"\xF0\x9F\x9A\x95",@"\xF0\x9F\x9A\x8C",@"\xF0\x9F\x9A\x93",@"\xF0\x9F\x9A\x92",@"\xF0\x9F\x9A\x91",@"\xF0\x9F\x9A\x9A",@"\xF0\x9F\x9A\x83",@"\xF0\x9F\x9A\x89",@"\xF0\x9F\x9A\x84",@"\xF0\x9F\x9A\x85",@"\xF0\x9F\x8E\xAB",@"\xE2\x9B\xBD",@"\xF0\x9F\x9A\xA5",@"\xE2\x9A\xA0",@"\xF0\x9F\x9A\xA7",@"\xF0\x9F\x94\xB0",@"\xF0\x9F\x8E\xB0",@"\xF0\x9F\x9A\x8F",@"\xF0\x9F\x92\x88",@"\xE2\x99\xA8",@"\xF0\x9F\x8F\x81",@"\xF0\x9F\x8E\x8C",@"\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5",@"\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7",@"\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3",@"\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8",@"\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7",@"\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8",@"\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9",@"\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA",@"\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7",@"\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA", nil];
    
    return arr;
}
@end
